import { SlicePipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { Observable, of, from } from 'rxjs';

import { User } from '@/app/core/model/user/user';
import { SuerService } from '@/app/core/service/api/user.service';

@Component({
  selector: 'app-userlist',
  templateUrl: './userlist.component.html',
  styleUrls: ['./userlist.component.scss']
})
export class UserlistComponent implements OnInit {

  public lists:Array<User>;
  childData = null;
  public color:string;
  constructor(public suerService: SuerService) { }


  ngOnInit(): void {

    /**调用列表 */
    this.getUserList();

  }

  /*获取数据列表*/
  getUserList(): void {
    this.suerService.getUserlist(6)
      .subscribe(res => { 
        //this.lists = res ;
        console.log('组件展示',res);
      }, err => {
          console.log('返回数据错误');
      },()=>{
        console.log('Complete');
      });
  }

  openDetail(item: any) {
    this.childData = item;
  }

  checkedBack(name: string) {
    this.lists.push({
      id:10,
      name:name
    });
  }

}
